package com.test.service.impl;


import com.test.dao.*;
import com.test.dao.impl.*;
import com.test.pojo.*;
import com.test.service.InfoService;

import java.util.List;
import java.util.Map;

public class InfoServiceImpl implements InfoService {
    private NewsDao newsDao = new NewsDaoImpl();
    private FeedbackDao feedbackDao = new FeedbackImpl();
    private NumDao numDao = new NumDaoImpl();
    private HistoryDao historyDao = new HistoryDaoImpl();

    @Override
    public int addNews(News news) {
        return newsDao.addNews(news);
    }

    @Override
    public List<News> findAllNews() {
        return newsDao.findAllNews();
    }

    @Override
    public List<News> findLatestNews() {
        return newsDao.findLatestNews();
    }

    @Override
    public News findNewsById(Integer id) {
        return newsDao.findNewsById(id);
    }

    @Override
    public List<News> findNewsByType(String type) {
        return newsDao.findNewsByType(type);
    }

    @Override
    public int addFeedback(Feedback feedback) {
        return feedbackDao.addFeedback(feedback);
    }

    @Override
    public List<Feedback> findFeedbackById(Integer id) {
        return feedbackDao.findFeedbackById(id);
    }

    @Override
    public int deleteFeedback(Integer id) {
        return feedbackDao.deleteFeedback(id);
    }

    @Override
    public List<News> findNews(Map<String, Object> queryParams) {
        return newsDao.findNews(queryParams);
    }

    @Override
    public List<Feedback> findFeedbackByType(String type) {
        return feedbackDao.findFeedbackByType(type);
    }

    @Override
    public List<Feedback> findAllFeedback() {
        return feedbackDao.findAllFeedback();
    }

    @Override
    public Map<String,Integer> getAllNum() {
        return numDao.getAllNum();
    }

    @Override
    public int updateNews(News news) {
        return newsDao.updateNews(news);
    }

    @Override
    public List<News> findNewsByTitle(String title) {
        return newsDao.findNewsByTitle(title);
    }

    @Override
    public int deleteNews(Integer id) {
        return newsDao.deleteNews(id);
    }

    @Override
    public List<Feedback> findFeedback(Map<String, Object> queryParams) {
        return feedbackDao.findFeedback(queryParams);
    }

    @Override
    public int addHistory(History history){
        return historyDao.addHistory(history);
    }

    @Override
    public int deleteHistory(Integer id) {
        return historyDao.deleteHistory(id);
    }

    @Override
    public List<History> findAllHistory(String nickName) {
        return historyDao.findAllHistory(nickName);
    }

    @Override
    public List<History> findHistoryById(Integer id) {
        return historyDao.findHistoryById(id);
    }

}
